/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bionic.shsc.db;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.NamingException;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

/**
 *
 * @author Ann
 */
public class ConnectionPool {

    MysqlDataSource  ods;
    Context ctx;
    private final String DATA_SOURCE = "scnet";

    public ConnectionPool() throws SQLException, NamingException {
        ods = new MysqlDataSource();

        String mLogin = "shsc";
        String mPass = "blabla12345678";

  
        ods.setDatabaseName("shsc");
        ods.setPortNumber(3306);
        ods.setUser(mLogin);
        ods.setPassword(mPass);
        //String url = ods.getURL();


    }

    public Connection getConnection() throws SQLException, NamingException {
        return ods.getConnection();
    }

    public void free(Connection conn) throws SQLException {
        if (conn != null) {
            conn.close();
        }

    }
}
